fix: preserve forward upstream URLs in cURL exports#395
Conversation
438bed5 to
e1e486f
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5ffc4a1ff0
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 91244a829a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Resolve the forward proxy trace-filter conflict while preserving upstream URL metadata. Co-authored-by: Talon <talon@users.noreply.github.com>
liaohch3
left a comment
There was a problem hiding this comment.
Reviewed after merging current main. The only manual conflict resolution preserves the Codex App trace filter and PR #395 upstream URL metadata together. Local lock, lint, format, focused proxy/viewer tests, and the full test suite pass.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a7fa0310ad
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const isLoopbackHost = /^(?:localhost|127(?:\.\d{1,3}){3}|\[?::1\]?)(?::\d+)?$/i.test(historicalHost); | ||
| const base = e.upstream_base_url | ||
| || (historicalHost && !isLoopbackHost ? `https://${historicalHost}` : 'https://api.anthropic.com'); |
There was a problem hiding this comment.
Reject unspecified proxy hosts in cURL fallback
For historical records without upstream_base_url, this guard still treats Host: 0.0.0.0:<port> as an upstream provider and copies https://0.0.0.0:<port>/...; fresh evidence is that claude_tap/cli.py:889-892 defaults --tap-no-launch proxy-only mode to bind on 0.0.0.0, so older reverse-proxy traces from that supported mode can store the local listener host rather than the real target. Those cURL exports should keep falling back to the provider/default instead of a dead local proxy address.
Useful? React with 👍 / 👎.
Summary
Problem
Forward-proxy records did not include
upstream_base_url, so the viewer fell back tohttps://api.anthropic.comeven when OpenCode or another client used a custom provider. This made copied cURL commands target the wrong service. API credentials remain omitted or redacted intentionally; restoring live keys would turn exported traces into credential leaks.Fixes #392.
Validation
uv lock --checkuv run ruff check .uv run ruff format --check .uv run pytest tests/ -x --timeout=60(990 passed, 25 skipped)Hostfallbackuv run python scripts/check_screenshots.py .agents/evidence/pr/issue-392-curl-upstream/opencode-forward-trace-upstream-metadata.pnguv run python scripts/verify_screenshots.pyagainst the exported viewer HTMLEvidence
Real trace viewer generated from
claude-tap --tap-client opencodewith OpenCode 1.16.0. The isolated run captured three records and returnedISSUE392_OK; the model trace recordshttps://opencode.aiplus/zen/v1/chat/completions, and the viewer copied the same full URL.